<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>Salvando arquivo com JavaScript + Java Applet</title>
  <script>
  
  /*
   * Recomendação da SUN para inserir um applet numa página com JavaScrip
   */
  function SUN() {
    var _app = navigator.appName;
  
    if (_app == 'Netscape') {
      document.write('<embed code="Applet1.class"',
                     'width="200"',
                     'height="200"',
                     'type="application/x-java-applet;version=1.5.0">');
      }
    else if (_app == 'Microsoft Internet Explorer') {
      document.write('<OBJECT ',
                     'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"',
                     'width="200"',
                     'height="200">',
                     '<PARAM name="code" value="Applet1.class">',
                     '</OBJECT>');
      }
    else {
      document.write('<p>Sorry, unsupported browser.</p>');
      }
  
  
  }
  
  function createApplet() {
  
    // IE
    if (document.all) {
      var applet = document.createElement('object');
      
      var s = '<object ' +
              'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ' +
              'width="1" ' +
              'height="1">' +
              '<param name="code" value="writeFile.class" />' +
              '<param name="archive" value="signedWriteFile.jar" />' +
              '</object>';

               
      document.getElementById('appletcontainer').innerHTML = s;
      
    // Others
    } else {
      var applet = document.createElement('applet');
      
      applet.id = 'appid';
      applet.code = 'writeFile.class';
      applet.archive = 'signedWriteFile.jar';
      applet.mayscript = '';
      
      document.getElementById('appletcontainer').appendChild(applet);  
    }
  }
  </script>
  
  <style>
  #appid {
    width: 1px;
    height: 1px;
  }
  </style>

  <body onload="createApplet();">
    <h1>Salvando arquivo com JavaScript + Java Applet</h1>
    
    <div>
      <span id='appletcontainer'></span><span><code>&lt;--</code> aqui estará o applet com 1x1 pixel de tamanho</span>
    </div>
    
    <p>
      Here's an applet that tries to write to the file <code>/tmp/foo</code>
      on a Solaris system (or to the file <code>C:\tmpfoo</code> on a
      Windows system.)
    </p>
    <p>
      and here's the <a href=writeFile.java>source</a>. 
    </p>
    <p>
      This applet is a signed applet.
    </p>

  </body>
</html>
